/*!
//      
//      \file	k2k_StateHandlerRdy1.h
//      
//      \author	Copyright 2010 Valentina Vuksic <vuksv1@bfh.ch>, Beat Liechti <liecb2@bfh.ch>
//      
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//      
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//      
//      You should have received a copy of the GNU General Public License
//      along with this program; if not, write to the Free Software
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//      MA 02110-1301, USA.
//
//		Abstract Data Type for the state handler of the state "Rdy1"
//      
//      \brief		CAS-EBX-03 Projektarbeit 
//      			Valentina Vuksic (VUKSV1), Beat Liechti (LIECB2)
//      			StateHandlerRdy1 ADT for the k2k (Kaffee2000) application
//      \version	1.0
//      \date		2010-04-11
//      \remark		Last Modifications:
//      \remark  	v1.0, VUKSV1/LIECB2, 2010-04-11 Initial release
//
*/

#ifndef __k2k_StateHandlerRdy1__
#define __k2k_StateHandlerRdy1__

#include <stdlib.h>
#include <signal.h>

#include "k2k_StateMachineTypes.h"
#include "k2k_StateMachine.h"

/*!
// k2k_StateHandlerRdy1 defines the data structure for the ADT 
// \brief k2k_StateHandlerRdy1 stuct for ADT
*/				
typedef struct k2k_StateHandlerRdy1_Struct
{	
	/*! state handler function */
	k2k_StateHandlerFunc handler;
	/*! state handler data */
	k2k_StateHandlerData *handlerData;
	/*! process id for aplay fork */
	pid_t pid;	
	/*! previous signal handler */ 
	struct sigaction oldAction;
	/*! new signal handler */
	struct sigaction usrAction;	
    /*! block mask for signaling */
    sigset_t blockMask;   
   	/*! state machine */
	k2k_StateMachine *stateMachine;
} k2k_StateHandlerRdy1;

/*!
//
// Creates StateHandlerRdy1 ADT "object"
//
// \param stateMachine is the pointer to the StateMachine structure
// 
// \return pointer to the StateHandlerRdy1 ADT
//
*/
k2k_StateHandlerRdy1* k2k_StateHandlerRdy1_Create(k2k_StateMachine *stateMachine);

/*!
//
// Releases StateHandlerRdy1 ADT "object"
// 
// \param stateHandlerRdy1 is the pointer to the StateHandlerRdy1 structure
// 
// \return noting
//
*/
void k2k_StateHandlerRdy1_Release(k2k_StateHandlerRdy1 *stateHandlerRdy1);

#endif
